<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
global $wpdb;
$tb = 'ap_painting_img';

if (isset($_POST['imgid'])) {
    $row = $wpdb->get_row("SELECT * FROM $tb WHERE id = {$_POST['imgid']}");
    $wpdb->query(
            $wpdb->prepare(
                    "
                DELETE FROM $tb
		 WHERE id = {$_POST['imgid']}"
            )
    );

    echo $row->user_id;
    die;
}
?>
